package cn.jiyun.entity;

import lombok.Data;
import lombok.ToString;

/**
 * @Author sjt
 * @Date 2023/7/26 10:46
 * @PackageName: cn.jiyun.vo/ResultData
 */
@Data
@ToString
public class ResultClass {
    private Integer code;
    private String message;
    private Object data;

    public static ResultClass ok(Object data){
        ResultClass resultData = new ResultClass();
        resultData.setCode(1);
        resultData.setMessage("成功");
        resultData.setData(data);
        return resultData;
    }

    public static ResultClass error(){
        ResultClass resultData = new ResultClass();
        resultData.setCode(2);
        resultData.setMessage("失败");
        return resultData;
    }

    public ResultClass Message(String message){
        this.message=message;
        return this;
    }
}
